import React, { Component } from 'react';
import { getUrlParam } from './actions/weixin'

class Redirect extends Component {

    componentDidMount() {
        const appid = getUrlParam('appid');
        const redirect_uri = encodeURIComponent(getUrlParam('redirectUri'));
        window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`;
    }

    render() {
        return (
            <div></div>
        );
    }
}

export default Redirect;